#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <chrono>
#include <QtOpenGLWidgets/QOpenGLWidget>
#include <QOpenGLShader>
#include <QOpenGLShaderProgram>
#include <QtWidgets/QtWidgets>
#include "ui_glwidget.h"

class glWidget : public QOpenGLWidget
{
	Q_OBJECT

public:
	glWidget(QWidget *parent = 0);
	~glWidget();


	void setFragmentSource(QString const&);

protected:
	virtual void initializeGL();

	virtual void resizeGL(int w, int h);

	virtual void paintGL();

	virtual void mouseMoveEvent(QMouseEvent *);

	virtual void mousePressEvent(QMouseEvent *);

private:


	QOpenGLShader*	_vertex;
	QOpenGLShader*	_fragment;

	QOpenGLShaderProgram* _program;
	QVector4D				_mouse;

	std::chrono::time_point<std::chrono::high_resolution_clock> _start;

private:
	Ui::glWidget ui;
};

#endif // GLWIDGET_H
